package com.ptswitch.material.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;

import org.hibernate.annotations.GenericGenerator;

import com.hxzon.util.MD5;

@Entity
@org.hibernate.annotations.Entity(dynamicInsert = true, dynamicUpdate = true)
public class Uzer implements Serializable {
	private static final long serialVersionUID = 7570429986649512051L;
	@Id
	@GeneratedValue(generator = "hibernateuuid")
	@GenericGenerator(name = "hibernateuuid", strategy = "uuid")
	@Column(length = 32)
	private String id;
	
	@Column(columnDefinition="varchar(32) default ''")
	private String username = "guest";
	
	@Column(columnDefinition="varchar(32) default ''")
	private String password = "xxx";
	
	@Column(columnDefinition="varchar(32) default ''")
	private String realname = "xxx";
	
	@Column(columnDefinition="varchar(218) default ''")
	private String email ;
	
	@Column(columnDefinition="varchar(32) default ''")
	private String createTime;

	@Column(length = 2)
	private int adminGrade = 9;
	
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getRealname() {
		return realname;
	}

	public void setRealname(String realname) {
		this.realname = realname;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getCreateTime() {
		return createTime;
	}

	public void setCreateTime(String createTime) {
		this.createTime = createTime;
	}

	public int getAdminGrade() {
		return adminGrade;
	}

	public void setAdminGrade(int adminGrade) {
		this.adminGrade = adminGrade;
	}

	public void md5password() {
		this.password = MD5.toMD5(this.username + this.password);
	}
	
	public String toString(){
		return this.realname+"::"+this.username+"::"+this.adminGrade;
	}

}
